package com.sinosoft.ebusiness.domain.elementManage;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.sinosoft.ebusiness.domain.elementManage.GeProductStepViewitem;
import com.sinosoft.ebusiness.domain.elementManage.GeRateCondition;
import com.sinosoft.ebusiness.domain.elementManage.GeRateConditionItemId;

//import org.hibernate.annotations.Cache;
//import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name = "GE_RATE_CONDITIONITEM")
//@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"})
public class GeRateConditionItem implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5908842183778258092L;

	private GeRateConditionItemId id;

	private GeRateCondition geRateCondition;

	private String conditionValue;

	private GeProductStepViewitem geProductStepViewitem;

	private String groupCode;
	private String processCode;

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "itemCode", column = @Column(name = "ITEMCODE")),
			@AttributeOverride(name = "conditionId", column = @Column(name = "CONDITIONID")),
			@AttributeOverride(name = "productCode", column = @Column(name = "PRODUCTCODE")),
			@AttributeOverride(name = "version", column = @Column(name = "VERSION")),
			@AttributeOverride(name = "condition", column = @Column(name = "CONDITION")) })
	public GeRateConditionItemId getId() {
		return this.id;
	}

	/**
	 * 属性ID的setter方法
	 */
	public void setId(GeRateConditionItemId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "CONDITIONID", referencedColumnName = "CONDITIONID", insertable = false, updatable = false) })
	//@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
	@JsonBackReference
	public GeRateCondition getGeRateCondition() {
		return geRateCondition;
	}

	public void setGeRateCondition(GeRateCondition geRateCondition) {
		this.geRateCondition = geRateCondition;
	}

	@Column(name = "CONDITIONVALUE")
	public String getConditionValue() {
		return conditionValue;
	}

	public void setConditionValue(String conditionValue) {
		this.conditionValue = conditionValue;
	}

	@Transient
	public String getGroupCode() {
		return groupCode;
	}

	public void setGroupCode(String groupCode) {
		this.groupCode = groupCode;
	}

	@Transient
	public String getProcessCode() {
		return processCode;
	}

	public void setProcessCode(String processCode) {
		this.processCode = processCode;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({
			@JoinColumn(name = "ITEMCODE", referencedColumnName = "ITEMCODE", insertable = false, updatable = false),
			@JoinColumn(name = "GROUPCODE", referencedColumnName = "GROUPCODE", insertable = false, updatable = false),
			@JoinColumn(name = "PRODUCTCODE", referencedColumnName = "PRODUCTCODE", insertable = false, updatable = false),
			@JoinColumn(name = "PROCESSCODE", referencedColumnName = "PROCESSCODE", insertable = false, updatable = false),
			@JoinColumn(name = "VERSION", referencedColumnName = "VERSION", insertable = false, updatable = false) })
	//@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
	@JsonBackReference
	public GeProductStepViewitem getGeProductStepViewitem() {
		return geProductStepViewitem;
	}

	public void setGeProductStepViewitem(
			GeProductStepViewitem geProductStepViewitem) {
		this.geProductStepViewitem = geProductStepViewitem;
	}

}
